package lcp;

/**
 * @author admin
 * LCP 01. 猜数字
 * 解题思路：直接比较两个数组相同位置上的数，相同则将变量res加1，最后返回res
 */
public class LCP01 {

    public int game(int[] guess, int[] answer) {
        int res = 0;
        for (int i = 0; i < guess.length; i++) {
            if (guess[i] == answer[i]){
                res++;
            }
        }
        return res;
    }

    public static void main(String[] args) {
        System.out.println(new LCP01().game(new int[]{1, 2, 3}, new int[]{1, 2, 3}));
    }
}
